From: | Curt Esser |
Date: | 3 Sep 99 at 11:58:47 |
Subject: | Re: Signed and Unsign numbers; Please help |
Hi Stephen
On 03-Sep-99, Stephen Lebed wrote:
> Hi everyone,
>
> I need to be able to hold values from 0 to 65535 in a word, but Blitz only
> allows me a signed value from -32768 to 32767. How can I get this to work.
>
> If I type
>
> a.w=65535
> Nprint a
>
> The answer that I get is
>
> -1
>
> Of course what I want it to display is 65535
>
>
> Is there a setting that I'm missing?
Try this:
First, make sure Overflow Errors is off in the compiler options (in the
debugger settings) Don't worry - as long as you are not storing values >
65535 in the word, no harm is done.
a.w=65535
b.w=47
Nprint "A = ", a AND $FFFF
Nprint "B = ", b AND $FFFF
The AND $FFFF makes sure it always returns the unsigned value of the
variable.
Note that you must do this every time you want to READ the value.
Don't use it when writing the value.
Later...
Yours electronically,
Curt Esser
camge@ix.netcom.com
http://members.xoom.com/Curt_Esser/
---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie